create subroutine
'
'
' ***** Create ***** v0123 = xywh : r0 = window : r1 = parent
'
SUB Create
IF (v0 <= 0) THEN v0 = 0
IF (v1 <= 0) THEN v1 = 0
IF (v2 <= 0) THEN v2 = designWidth
IF (v3 <= 0) THEN v3 = designHeight
XuiCreateGrid (@grid, XuiDialog2B, @v0, @v1, @v2, @v3, r0, r1,
&XuiDialog2B())
XuiLabel (@g, #Create, 0, 0, 0, 0, r0, grid)
XuiTextLine (@g, #Create, 0, 0, 0, 0, r0, grid)
XuiSendMessage ( g, #SetCallback, grid, &XuiDialog2B(), -1, -1, $TextLine,
grid)
XuiPushButton (@g, #Create, 0, 0, 0, 0, r0, grid)
XuiSendMessage ( g, #SetCallback, grid, &XuiDialog2B(), -1, -1, $Button0, grid)
XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"Enter")
XuiPushButton (@g, #Create, 0, 0, 0, 0, r0, grid)
XuiSendMessage ( g, #SetCallback, grid, &XuiDialog2B(), -1, -1, $Button1, grid)
XuiSendMessage ( g, #SetTextString, 0, 0, 0, 0, 0, @"Cancel")
GOSUB Resize
END SUB
Every grid function has a Create subroutine to process Create messages. Each time a
grid function receives a Create message, it must create a new grid of its own grid type.
It does this by calling XuiCreateGrid() to create the base grid. Then, if the
grid type has kid grids, it calls the appropriate grid functions to create them.
After it creates each kid grid, the grid function sets itself as the callback function for
the kid grid - assuming it wants to receive callback messages from the kid.
Configuration messages like SetBorder, SetColor, SetTextString must be sent to each
kid grid before the next kid grid is created as are the PushButton "Enter" and
"Cancel" strings in the example above.
After it creates and configures all its kids, the Create subroutine must call its Resize
subroutine, even if its Resize subroutine is empty. Any additional code required in
the Create subroutine, should be carried out in separate subroutines and called
immediately before and/or after GOSUB Resize.
CreateWindow subroutine
'
'
' ***** CreateWindow ***** r0 = windowType : r1 = &WindowFunc()
'
SUB CreateWindow
IF (v0 = 0) THEN v0 = designX
IF (v1 = 0) THEN v1 = designY
IF (v2 <= 0) THEN v2 = designWidth
IF (v3 <= 0) THEN v3 = designHeight
XuiWindow (@window, #WindowCreate, v0, v1, v2, v3, r0, @r1$)
v0 = 0 : v1 = 0 : r0 = window : ATTACH r1$ TO display$
GOSUB Create
r1 = 0 : ATTACH display$ TO r1$
XuiWindow (window, #WindowRegister, grid, -1, v2, v3, @r0,
@"XuiDialog2B")
END SUB
Virtually every grid function has a CreateWindow subroutine to process CreateWindow
messages. Each time a grid function receives a CreateWindow message, it creates a
new grid of its own grid type surrounded by a new window. Since grids must be
created in a window, it first creates the window, then calls the Create subroutine to
create the grid. There are few ways to modify the CreateWindow subroutine
successfully, so it is rarely if ever attempted.